package com.tianji.learning.controller;


import com.tianji.learning.domin.po.PointsBoardSeason;
import com.tianji.learning.domin.vo.PointsBoardVO;
import com.tianji.learning.query.PointsBoardQuery;
import com.tianji.learning.service.IPointsBoardService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 学霸天梯榜 前端控制器
 * </p>
 *
 * @author author
 * @since 2023-11-09
 */
@RestController
@RequestMapping("/boards")
@RequiredArgsConstructor
public class PointsBoardController {

    private final IPointsBoardService pointsBoardService;
    @ApiOperation("分页查询指定赛季的积分排行榜")
    @GetMapping
    public PointsBoardVO getLeaderboard(PointsBoardQuery query) {
        return pointsBoardService.queryPointsBoardBySeason(query);
    }

    @ApiOperation("获取所有赛季")
    @GetMapping("/seasons/list")
    public List<PointsBoardSeason> findAllSeasons() {
        return pointsBoardService.findAllSeasons();
    }
}
